home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Whiteline: delta
/
whiteline CD Series - delta.iso
/
progtool
/
modula2
/
module
/
soundgem.mod
< prev
next >
Wrap
Text File
|
1995-11-25
|
5KB
|
153 lines
MODULE SoundGem;
FROM SYSTEM IMPORT VAL,ADDRESS;
IMPORT DOSound;
FROM Sounds IMPORT Sound,Wave,Volume,Noise,SoundAndNoiseOnOff;
FROM AES IMPORT ResourceGetAddr;
FROM ConvertStr IMPORT StrToCard;
FROM Applications IMPORT Init,Terminate,(*deskx,desky,deskw,deskh,*)
InitResource(*,ShowMenuBar,ShowNormal,DeskTree,
MenuTree,Colour,Appl*);
FROM EasyDialog IMPORT DoMoveDialog,IsSelected,GetText,IsCrossed;
CONST
TREE1 = 0; (* TREE *)
LAUTST1 = 2; (* OBJECT in TREE #0 *)
LAUTST2 = 3; (* OBJECT in TREE #0 *)
LAUTST3 = 4; (* OBJECT in TREE #0 *)
DREIECK = 11; (* OBJECT in TREE #0 *)
SAEGESTG = 14; (* OBJECT in TREE #0 *)
SAEGEFAL = 16; (* OBJECT in TREE #0 *)
HUELLK1 = 10; (* OBJECT in TREE #0 *)
HUELLK2 = 13; (* OBJECT in TREE #0 *)
HUELLK3 = 15; (* OBJECT in TREE #0 *)
TEST = 6; (* OBJECT in TREE #0 *)
OKSOUND = 25; (* OBJECT in TREE #0 *)
CANCELSO = 35; (* OBJECT in TREE #0 *)
HKFREQU = 12; (* OBJECT in TREE #0 *)
RAUSCHFR = 28; (* OBJECT in TREE #0 *)
RAUSCH1 = 30; (* OBJECT in TREE #0 *)
RAUSCH2 = 32; (* OBJECT in TREE #0 *)
RAUSCH3 = 34; (* OBJECT in TREE #0 *)
TON1 = 18; (* OBJECT in TREE #0 *)
TON2 = 19; (* OBJECT in TREE #0 *)
TON3 = 20; (* OBJECT in TREE #0 *)
TONAN1 = 22; (* OBJECT in TREE #0 *)
TONAN2 = 23; (* OBJECT in TREE #0 *)
TONAN3 = 21; (* OBJECT in TREE #0 *)
ə
VAR RSCfileName : ARRAY [0..80] OF CHAR;
OK : BOOLEAN;
diaret : INTEGER;
DiaAdr :ADDRESS;
PROCEDURE SetSoundHz(Channel,Freq :CARDINAL);
VAR Sc : LONGCARD;
BEGIN
IF Freq#0 THEN
Sc := 125000D;
Sound(Channel,VAL(CARDINAL,(Sc DIV VAL(LONGCARD,Freq))))
END(*IF*);
END SetSoundHz;
PROCEDURE SetWaveLengthHz(Channel,Form, Freq :CARDINAL);
BEGIN
IF Freq#0 THEN
Wave(Channel,Form,7812 DIV Freq)
END(*IF*);
END SetWaveLengthHz;
PROCEDURE SoundOff;
BEGIN
SoundAndNoiseOnOff(7,7);
Wave(1,0,0);
Wave(2,0,0);
Wave(3,0,0)
END SoundOff;
PROCEDURE DoSoundDial;
VAR Huellkurve : CARDINAL;
OK :BOOLEAN;
Zahl : CARDINAL;
String : ARRAY [0..10] OF CHAR;
SoundFlag,NoiseFlag:CARDINAL;
BEGIN
SoundOff;
Huellkurve:=11;
IF IsSelected(DREIECK,DiaAdr) THEN
Huellkurve:=10;
ELSIF IsSelected(SAEGESTG,DiaAdr) THEN
Huellkurve:=12;
ELSIF IsSelected(SAEGEFAL,DiaAdr) THEN
Huellkurve:=8;
END(*IF*);
SoundFlag:=0;NoiseFlag:=0; (* alles an ! *)
IF ~IsCrossed(TONAN1,DiaAdr) THEN (* wenn nicht angekreutzt *)
SoundFlag:=SoundFlag+1; (* dann ausschalten *)
END(*IF*);
IF ~IsCrossed(TONAN2,DiaAdr) THEN
SoundFlag:=SoundFlag+2;
END(*IF*);
IF ~IsCrossed(TONAN3,DiaAdr) THEN
SoundFlag:=SoundFlag+4;
END(*IF*);
IF ~IsCrossed(RAUSCH1,DiaAdr) THEN
NoiseFlag:=NoiseFlag+1;
END(*IF*);
IF ~IsCrossed(RAUSCH2,DiaAdr) THEN
NoiseFlag:=NoiseFlag+2;
END(*IF*);
IF ~IsCrossed(RAUSCH3,DiaAdr) THEN
NoiseFlag:=NoiseFlag+4;
END(*IF*);
GetText(LAUTST1,DiaAdr,String);
StrToCard(String,Zahl,OK);
Volume(1,Zahl);
GetText(LAUTST2,DiaAdr,String);
StrToCard(String,Zahl,OK);
Volume(2,Zahl);
GetText(LAUTST3,DiaAdr,String);
StrToCard(String,Zahl,OK);
Volume(3,Zahl);
GetText(TON1,DiaAdr,String);
StrToCard(String,Zahl,OK);
SetSoundHz(1,Zahl);
GetText(TON2,DiaAdr,String);
StrToCard(String,Zahl,OK);
SetSoundHz(2,Zahl);
GetText(TON3,DiaAdr,String);
StrToCard(String,Zahl,OK);
SetSoundHz(3,Zahl);
GetText(RAUSCHFR,DiaAdr,String);
StrToCard(String,Zahl,OK);
Noise(Zahl);
GetText(HKFREQU,DiaAdr,String);
StrToCard(String,Zahl,OK);
IF IsSelected(HUELLK1,DiaAdr) THEN
SetWaveLengthHz(1,Huellkurve,Zahl);
END(*IF*);
IF IsSelected(HUELLK2,DiaAdr) THEN
SetWaveLengthHz(2,Huellkurve,Zahl);
END(*IF*);
IF IsSelected(HUELLK3,DiaAdr) THEN
SetWaveLengthHz(3,Huellkurve,Zahl);
END(*IF*);
SoundAndNoiseOnOff(NoiseFlag,SoundFlag); (* Ton und Rauschgeneratoren ein *)
END DoSoundDial;
BEGIN
RSCfileName :='Sound.rsc';
Init;
OK:=InitResource(-1,-1,RSCfileName);
(*GrafMouse(Arrow,NIL);*)
ResourceGetAddr(0,TREE1,DiaAdr);
REPEAT
diaret:=DoMoveDialog(DiaAdr,LAUTST1);
IF diaret=TEST THEN DoSoundDial
ELSE SoundOff;
END(*IF*);
UNTIL diaret=OKSOUND;
Terminate;
DOSound.Hymne
END SoundGem.